<template>
  <div class="AddOrUpdate_main add_container add_container_table">
    <div class="main_main ">
      <el-form ref="form" :model="showData" :inline="true">
        <div
          v-for="(item2,index2) in showKey.columns"
          :key="index2"
          :class="getClass(item2)"
        >
          <el-form-item v-if="item2.type=='form'" :label="item2.name">
            <div v-if="!showData[item2.key]&&showData[item2.key]!==0&&showData[item2.key]!=='0'" class="show noData">暂无</div>
            <div v-else class="show">{{ showData[item2.key] }}</div>
          </el-form-item>
          <el-form-item v-if="item2.type=='formData2'" :label="item2.name">
            <div v-if="!showData.saleDeliverInformation||!showData.saleDeliverInformation[item2.key]" class="show noData">暂无</div>
            <div v-else class="show">{{ showData.saleDeliverInformation[item2.key] }}</div>
          </el-form-item>
          <el-form-item v-if="item2.type=='file'" :label="item2.name">
            <FileManageFull
              :file-names="showData[item2.fileName]"
              :file-real-names="showData[item2.fileRealName]"
              :file-urls="showData[item2.fileUrl]"
              :row-index="1"
              :readonly="true"
              @fileName="setFileName"
            />
          </el-form-item>
          <div v-if="item2.type=='table'" class="formItem_header">
            {{ item2.name }}
          </div>
          <div v-if="item2.type=='table'" ref="table_container" class="table_container">
            <el-table
              ref="table"
              :data="showData[item2.key]"
              stripe
              border
              height="420"
              row-key="id"
              style="width: 99.9%;"
            >
              <el-table-column label="物料编码" min-width="150" prop="materialCode" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <span>{{ scope.row.materialCode }}</span>
                </template>
              </el-table-column>
              <el-table-column label="物料名称" min-width="150" prop="materialName" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <span>{{ scope.row.materialName }}</span>
                </template>
              </el-table-column>
              <el-table-column label="规格型号" min-width="150" prop="materialModel" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <span>{{ scope.row.materialModel }}</span>
                </template>
              </el-table-column>
              <el-table-column label="物料单位" min-width="100" prop="materialUnitName" :show-overflow-tooltip="true">
                <template slot-scope="scope">
                  <span>{{ scope.row.materialUnitName }}</span>
                </template>
              </el-table-column>
              <el-table-column label="订单数量" :min-width="SETTINGS.settings_decimalDigits_length" prop="orderNumber">
                <template slot-scope="scope">
                  <span>{{ scope.row.orderNumber }}</span>
                </template>
              </el-table-column>
              <el-table-column label="已发数量" :min-width="SETTINGS.settings_decimalDigits_length" prop="alreadyDeliverNumber">
                <template slot-scope="scope">
                  <span>{{ scope.row.alreadyDeliverNumber }}</span>
                </template>
              </el-table-column>
              <el-table-column label="未发数量" :min-width="SETTINGS.settings_decimalDigits_length" prop="orderNumber">
                <template slot-scope="scope">
                  <span>{{ scope.row.willDeliverNumber }}</span>
                </template>
              </el-table-column>
              <el-table-column label="发货比例(%)" :min-width="SETTINGS.settings_decimalDigits_length" prop="deliverPercent">
                <template slot-scope="scope">
                  <span>{{ scope.row.deliverPercent }}</span>
                </template>
              </el-table-column>
            </el-table>
          </div>
        </div>
      </el-form>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ShowDetail',
  props: {
    layerid: {},
    showKey: {},
    showData: {},
    businessId: {}
  },
  data() {
    return {
      pageId: '查看', // 页面唯一标识
      activeName: '1'
    }
  },
  mounted() {
  },
  methods: {
    setFileName(...data) {
      this.tableData[data[3]].fileName = data[0]
      this.tableData[data[3]].fileRealName = data[1]
      this.tableData[data[3]].fileUrl = data[2]
    },
    getClass(item) {
      let res = ''
      if (item.type == 'form' || item.type == 'formData2') {
        res += 'showItem'
        if (item.length && item.length == 'double') {
          res += ' double'
        }
      } else if (item.type == 'table') {
        res += 'showTableTwo'
      } else {
        res += 'showTable'
      }
      return res
    }
  }
}
</script>

<style lang="less" scoped>
/deep/ .el-tabs__content{
    overflow: auto;
}
.main_main{
  padding-top: 0px;
  .el-form{
    height: 100%;
    align-content: flex-start;
    .showItem{
      margin-left: 20px;
      margin-right: 20px;
      width: calc(50% - 40px);
    }

    /deep/ .el-form-item{
      width: 100%;
      border-bottom: 1px solid #D6D6D6;
      margin-left: 0;
      margin-right: 0;
      margin-bottom: 0;
      .el-form-item__label:before{
        content: none;
      }
      .el-form-item__label{
        color: #1F51B3;
        font-size: 15px;
      }
      .el-form-item__label{
        width: 140px !important;
        margin-top: 10px;
      }
      .el-form-item__content{
        word-break: break-all;
        color: #333333;
        font-size: 15px;
        flex: 1;
        width: unset;
        margin-right: 0px;
      }
    }
    .double{
      width: calc(100% - 40px);
      //height: auto;
      ///deep/ .el-form-item__content{
      //  height: auto;
      //}
      ///deep/ .el-form-item{
      //  height: auto;
      //}
      //.show{
      //  overflow: hidden;
      //  text-overflow: ellipsis;
      //  display: -webkit-box;
      //  -webkit-line-clamp: 2;
      //  -webkit-box-orient: vertical;
      //}
    }
    .showTableTwo {
      width: 100% !important;
      /deep/  .el-form-item{
        margin-left: 10px !important;
        padding-right: 10px !important;
      }
    }
    .showTable{
      width: 100%;
      /deep/  .el-form-item{
        margin-left: 20px !important;
        margin-right: 20px !important;
        width: auto;
      }
    }
  }
  .column_one{
    .showItem{
      width: 100% !important;
    }
  }
  /deep/ .el-tab-pane{
    align-content: flex-start;
  }
}
.column_one{
  .showItem{
    width: 100% !important;
  }
}
.show{
  height: fit-content !important;
  padding-top: 10px;
  padding-bottom: 10px;
}
.FileManageFull_container{
  padding-top: 10px;
  padding-left: 10px;
}
.noData{
  color: #c0c4cc;
}
/deep/.el-table__cell:nth-of-type(1){
  .cell{
    padding-left: 23px !important;
  }
}

/deep/ .el-tabs{
  height: 100%;
}

/deep/ .el-tabs__header{
  margin: 0;
}
.el-table {
  font-size: 15px;
}
</style>
